<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: {2021/1/7}
 * Time: {13:51}
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\admin\exception;


use app\common\lib\Show;
use think\exception\Handle;
use think\exception\HttpException;
use think\Response;
use Throwable;

class Http extends Handle
{
    protected $httpStatus = 500;

    public function render($request, Throwable $e): Response
    {

        if (method_exists($e, "getStatusCode")) {
            $httpStatus = $e->getStatusCode();
        } else {
            $httpStatus = $this->httpStatus;
        }
        return Show::json_show(config('status.error'), $e->getMessage(), [], $httpStatus);
    }
}